package com.example.demo.controller;

import com.example.demo.entity.UserEntity;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.Date;


/**
 *  后台管理员模块
 */
@RestController
@RequestMapping(value = "/admin")
public class Demo {


    /**
     *  添加用户
     * @param user 用户实体
     * @return {@link UserEntity}
     */
    @RequestMapping(value = "/addUser.do")
    public UserEntity addUser(@Valid UserEntity user){
        Long currTime = new Date().getTime();
        user.setUserCreateTime(currTime);
        user.setUserUpdateTime(currTime);
        return user;
    }


}
